package com.blazer.e;

public class test09 {
    public static void main(String[] args) {
//对象数组
        XueSheng[] student=new XueSheng[3];
        XueSheng xueSheng=new XueSheng("学生1",12);
        XueSheng xueSheng1=new XueSheng("学生2",32);
        XueSheng xueSheng2=new XueSheng("学生3",22);
student[0]=xueSheng;
student[1]=xueSheng1;
student[2]=xueSheng2;
for(int i=0;i<student.length;i++){
    System.out.println(student[i].getName());
    for (int j=0;j<student.length-1-i;j++){
        if(student[j].getScore()>student[j+1].getScore()){
            XueSheng temp=student[j];
            student[j]=student[j+1];
            student[j+1]=temp;
        }
    }
}
for(int i=0;i<student.length;i++){

    System.out.println(student[i]);
}
    }

}
